package Java1Test.ArrayList;

import java.util.ArrayList;

public class ArrayListTest1 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");

//        System.out.println(list);

        for (int i = 0; i < list.size(); i++) {
            if (i == list.size() - 1) {
                System.out.print(list.get(i) + "]");
            } else if (i == 0) {
                System.out.print("[" + list.get(i) + ",");
            } else {
                System.out.print(list.get(i) + ",");
            }
        }

    }
}
